﻿using System.Web.Mvc;
using Diploma.Models;

namespace DiplomaWeb.Controllers
{
    [Authorize(Roles = "Administrator")]
    public class QualificationLevelsController : MasterController
    {
        public QualificationLevelsController(DataManager dataManager) : base(dataManager)
        {
        }

        //[HttpGet]
        //public ActionResult Edit(int id)
        //{
        //    QualificationLevel level = DataManager.QualificationLevelsRepository.GetLevel(id);
        //    if (level == null)
        //        throw new Exception();

        //    return PartialView("~/Views/Administrators/Levels/EditControl.ascx", level);
        //}
        //[HttpPost]
        //public ActionResult Edit(QualificationLevel updatedLevel)
        //{           
        //    DataManager.QualificationLevelsRepository.Edit(updatedLevel);
        //    return Redirect(System.Web.HttpContext.Current.Request.Url.AbsolutePath);
        //}

        //[HttpPost]
        //public ActionResult Delete(int id)
        //{
        //    QualificationLevel level = DataManager.QualificationLevelsRepository.GetLevel(id);
        //    if (level == null)
        //        throw new Exception();
        //    DataManager.QualificationLevelsRepository.Delete(level);

        //    return Redirect(System.Web.HttpContext.Current.Request.Url.AbsolutePath);
        //}

        public ActionResult ListJSON()
        {
            JsonResult v = Json(DataManager.QualificationLevelsRepository.GetAllLevels());
            return v;
        }
    }
}